<?php

declare(strict_types=1);

namespace Modules\Salesmanagement\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 * @property $fid
 * @property $fbillno
 * @property $fsaleorgid_number
 * @property $fsaleorgid_name
 * @property $fcustomerid_number
 * @property $fcustomerid_name
 * @property $fdocumentstatus
*/
class Salesout extends Model
{
    

    protected $table = 'salesout';

    protected $fillable = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'fid', 'fbillno', 'fsaleorgid_number', 'fsaleorgid_name', 'fcustomerid_number', 'fcustomerid_name', 'fdocumentstatus','state','writestate','incomingtype','fpurchaseorgid_number','fpurchaseorgid_name','fsupplierid_number','fsupplierid_name'];

    /**
     * @var array
     */
    protected array $fields = ['id','created_at','updated_at','fid','fbillno','fsaleorgid_number','fsaleorgid_name','fcustomerid_number','fcustomerid_name','fdocumentstatus','state','writestate','incomingtype','fpurchaseorgid_number','fpurchaseorgid_name','fsupplierid_number','fsupplierid_name'];

    /**
     * @var array
     */
    protected array $form = ['created_at','updated_at','fid','fbillno','fsaleorgid_number','fsaleorgid_name','fcustomerid_number','fcustomerid_name','fdocumentstatus','state','writestate','incomingtype','fpurchaseorgid_number','fpurchaseorgid_name','fsupplierid_number','fsupplierid_name'];

      /**
     * @var array
     */
    public array $searchable = [
        'fbillno' => 'like',
        'fsaleorgid_number' => 'like',
        'fsaleorgid_name' => 'like',
        'fcustomerid_number' => 'like',
        'fcustomerid_name' => 'like',
        'fdocumentstatus' => '=',
        'state' => '=',
        'writestate' => '=',
    ];
   
    /**
     * 链表查询
     */
    public function detailscheckOne()
    {
        return $this->hasOne(SalesoutAttached::class);//查一条
    }

    public function detailscheckAll()
    {
        return $this->hasMany(SalesoutAttached::class);//查多条
    }



   
    //输出相应的时间格式
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }
  

    
}
